package cn.stylefeng.guns.modular.gridsystem.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.gridsystem.service.BizGatewayStartupLogService;
import cn.stylefeng.guns.modular.gridsystem.model.param.BizGatewayStartupLogParam;
import javax.annotation.Resource;

/**
 * 网关启动日志 控制器
 *
 * @author: ssy
 * @date: 2022/09/16 10:13
 */
@RestController
public class BizGatewayStartupLogController {

    @Resource
    private BizGatewayStartupLogService bizGatewayStartupLogService;

    /**
     * 分页查询网关启动日志
     *
     * @author ssy
     * @date 2022/09/16 10:13
     */
    @GetMapping("/bizGatewayStartupLog/page")
    @BusinessLog(title = "网关启动日志_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(BizGatewayStartupLogParam bizGatewayStartupLogParam) {
        return new SuccessResponseData(bizGatewayStartupLogService.page(bizGatewayStartupLogParam));
    }

    /**
     * 获取全部网关启动日志
     *
     * @author ssy
     * @date 2022/09/16 10:13
     */
    @GetMapping("/bizGatewayStartupLog/list")
    @BusinessLog(title = "网关启动日志_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list( ) {
        return new SuccessResponseData(bizGatewayStartupLogService.list());
    }

    /**
     * 查看详情网关启动日志
     *
     * @author ssy
     * @date 2022/09/16 10:13
     */
    @GetMapping("/bizGatewayStartupLog/detail")
    @BusinessLog(title = "网关启动日志_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(BizGatewayStartupLogParam.detail.class) BizGatewayStartupLogParam bizGatewayStartupLogParam) {
        return new SuccessResponseData(bizGatewayStartupLogService.detail(bizGatewayStartupLogParam));
    }

    /**
     * 添加网关启动日志
     *
     * @author ssy
     * @date 2022/09/16 10:13
     */
    @PostMapping("/bizGatewayStartupLog/add")
    @BusinessLog(title = "网关启动日志_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(BizGatewayStartupLogParam.add.class) BizGatewayStartupLogParam bizGatewayStartupLogParam) {
        bizGatewayStartupLogService.add(bizGatewayStartupLogParam);
        return new SuccessResponseData();
    }

    /**
     * 删除网关启动日志
     *
     * @author ssy
     * @date 2022/09/16 10:13
     */
    @PostMapping("/bizGatewayStartupLog/delete")
    @BusinessLog(title = "网关启动日志_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(BizGatewayStartupLogParam.delete.class) BizGatewayStartupLogParam bizGatewayStartupLogParam) {
        bizGatewayStartupLogService.delete(bizGatewayStartupLogParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑网关启动日志
     *
     * @author ssy
     * @date 2022/09/16 10:13
     */
    @PostMapping("/bizGatewayStartupLog/edit")
    @BusinessLog(title = "网关启动日志_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(BizGatewayStartupLogParam.edit.class) BizGatewayStartupLogParam bizGatewayStartupLogParam) {
        bizGatewayStartupLogService.edit(bizGatewayStartupLogParam);
        return new SuccessResponseData();
    }


}
